home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Skunkware 5
/
Skunkware 5.iso
/
src
/
X11
/
xsw
/
colorhelp.c
< prev
next >
Wrap
C/C++ Source or Header
|
1995-05-09
|
34KB
|
1,143 lines
/***************************************************************************
*
* Copyright (c) 1990-1993 The Santa Cruz Operation, Inc.
*
* All rights reserved. No part of this program or publication may be
* reproduced, transmitted, transcribed, stored in a retrieval system,
* or translated into any language or computer language, in any form or
* by any means, electronic, mechanical, magnetic, optical, chemical,
* biological, or otherwise, without the prior written permission of:
*
* The Santa Cruz Operation , Inc. (408) 425-7222
* 400 Encinal St., Santa Cruz, California 95060 USA
*
**************************************************************************/
/*
* SCCS Stuff
*
* @(#) colorhelp.c 9.1 93/05/25 SCOINC
*
* S001, 15-Sep-93, rickra
* Added disk space help.
* Made modifications so that help window is on a per window basis,
* rather than having the toplevel being the MAIN window....
*
*
* S000, 25-may-93, rickra
* Added copyright and modification history
*/
#include <X11/Xlib.h>
#include <X11/Intrinsic.h>
#include <Xm/Xm.h>
#include <Xm/DrawingA.h>
#include <Xm/DialogS.h>
#include "include/unixincs.h"
#include "include/buttons.h"
#include "include/xsw.h"
extern struct NetworkXswStruct *head_server;
extern int server_count;
Widget temp_drawing_area;
Widget temporary_widget;
Display *temp_display;
Window temp_window;
int temp_screen;
GC temp_gc;
int doing_help = 0;
int current_colorHelp_button_num;
void
set_color_dialog_string (position, display_string, color, button_number)
int position;
char *display_string;
unsigned long color;
int button_number;
{
int x, y, w, h;
#define BOXTHICKNESS 3
#ifdef DEBUG_COLOR_HELP
fprintf (stdout, "in set_color_dialog_string...\n");
#endif
temp_window = XtWindow (temp_drawing_area);
XSetForeground (temp_display, temp_gc, foreground);
XSetLineAttributes (temp_display, temp_gc, BOXTHICKNESS,
LineSolid, CapButt, JoinMiter);
XDrawRectangle (temp_display, temp_window, temp_gc,
x = 10,
y = position - FHEIGHT,
w = FWIDTH * 2,
h = FHEIGHT);
XSetForeground (temp_display, temp_gc, color);
XFillRectangle (temp_display, temp_window, temp_gc, x, y, w, h);
XSetForeground (temp_display, temp_gc, foreground);
XDrawString (temp_display, temp_window, temp_gc, 70, position,
display_string, strlen (display_string));
#ifdef DEBUG_COLOR_HELP
fprintf (stdout, "leaving set_color_dialog_string...\n");
#endif
}
static void
popup_callback (my_widget, client_data, cbs)
Widget my_widget;
struct expose_callback_struct *client_data;
XmAnyCallbackStruct *cbs;
{
char *cptr;
char s80[80];
int len;
int line_len;
int space = FWIDTH * 4;
int file_box_start;
int inodes_box_start;
int proc_box_start;
int region_box_start;
int cblocks_box_start;
int x, y, w, h;
int button_number;
struct NetworkXswStruct *server_pointer;
button_number = client_data -> button_number;
server_pointer = client_data -> server_pointer;
temporary_widget = server_pointer ->
SEPERATE_WINDOWS_LIST[button_number].colorHelp.toplevel;
temp_drawing_area = server_pointer ->
SEPERATE_WINDOWS_LIST[button_number].colorHelp.drawing_area;
temp_display = server_pointer ->
SEPERATE_WINDOWS_LIST[button_number].colorHelp.display;
temp_window = server_pointer ->
SEPERATE_WINDOWS_LIST[button_number].colorHelp.window;
temp_screen = server_pointer ->
SEPERATE_WINDOWS_LIST[button_number].colorHelp.screen;
temp_gc = server_pointer ->
SEPERATE_WINDOWS_LIST[button_number].colorHelp.gc;
temp_window = XtWindow (temp_drawing_area);
XClearWindow (temp_display, temp_window);
switch (button_number)
{
case BUTTON_cpu:
sprintf (s80, "%s", "User scale color");
cptr = s80;
set_color_dialog_string (FHEIGHT * 3, cptr, colorUser.pixel);
sprintf (s80, "%s", "Kernel scale color");
cptr = s80;
set_color_dialog_string (FHEIGHT * 6, cptr, colorKernel.pixel);
sprintf (s80, "%s", "Break scale color");
cptr = s80;
set_color_dialog_string (FHEIGHT * 9, cptr, colorBreak.pixel);
sprintf (s80, "%s", "Numeric alarm color");
cptr = s80;
set_color_dialog_string (FHEIGHT * 12, cptr, colorNumericAlarm.pixel);
sprintf (s80, "%s", "Numeric warning color");
cptr = s80;
set_color_dialog_string (FHEIGHT * 15, cptr, colorNumericWarning.pixel);
sprintf (s80, "%s", "Numeric color");
cptr = s80;
set_color_dialog_string (FHEIGHT * 18, cptr, colorNumeric.pixel);
break;
case BUTTON_wait:
sprintf (s80, "%s", "I/O scale color");
cptr = s80;
set_color_dialog_string (FHEIGHT * 3, cptr, colorIo.pixel);
sprintf (s80, "%s", "Page I/O scale color");
cptr = s80;
set_color_dialog_string (FHEIGHT * 6, cptr, colorPio.pixel);
sprintf (s80, "%s", "Swap scale color");
cptr = s80;
set_color_dialog_string (FHEIGHT * 9, cptr, colorSwap.pixel);
sprintf (s80, "%s", "Numeric alarm color");
cptr = s80;
set_color_dialog_string (FHEIGHT * 12, cptr, colorNumericAlarm.pixel);
sprintf (s80, "%s", "Numeric warning color");
cptr = s80;
set_color_dialog_string (FHEIGHT * 15, cptr, colorNumericWarning.pixel);
sprintf (s80, "%s", "Numeric color");
cptr = s80;
set_color_dialog_string (FHEIGHT * 18, cptr, colorNumeric.pixel);
break;
case BUTTON_cache:
sprintf (s80, "%s", "Cache scale write HIT");
cptr = s80;
set_color_dialog_string (FHEIGHT * 3, cptr, colorCacheWriteHit.pixel);
sprintf (s80, "%s", "Cache scale read HIT");
cptr = s80;
set_color_dialog_string (FHEIGHT * 6, cptr, colorCacheReadHit.pixel);
sprintf (s80, "%s", "Cache scale write MISS");
cptr = s80;
set_color_dialog_string (FHEIGHT * 9, cptr, colorCacheWriteMiss.pixel);
sprintf (s80, "%s", "Cache scale read MISS");
cptr = s80;
set_color_dialog_string (FHEIGHT * 12, cptr, colorCacheReadMiss.pixel);
sprintf (s80, "%s", "Cache scale write MISS WARNING");
cptr = s80;
set_color_dialog_string (FHEIGHT * 15, cptr,
colorCacheWriteMissWarning.pixel);
sprintf (s80, "%s", "Cache scale write MISS WARNING");
cptr = s80;
set_color_dialog_string (FHEIGHT * 18, cptr,
colorCacheReadMissWarning.pixel);
sprintf (s80, "%s", "Cache scale write MISS ALARM");
cptr = s80;
set_color_dialog_string (FHEIGHT * 21, cptr,
colorCacheWriteMissAlarm.pixel);
sprintf (s80, "%s", "Cache scale read MISS ALARM");
cptr = s80;
set_color_dialog_string (FHEIGHT * 24, cptr,
colorCacheReadMissAlarm.pixel);
break;
case BUTTON_other:
/*
* Draw title strings.....
*/
sprintf (s80, "%s", "File");
cptr = s80;
line_len = 0;
XSetForeground (temp_display, temp_gc, foreground);
XDrawString (temp_display, temp_window, temp_gc, 100, FHEIGHT * 3,
cptr, strlen (cptr));
file_box_start = 100;
line_len += (FWIDTH * strlen (cptr)) + space;
sprintf (s80, "%s", "Inodes");
cptr = s80;
XSetForeground (temp_display, temp_gc, foreground);
XDrawString (temp_display, temp_window, temp_gc,
100 + line_len, FHEIGHT * 3,
cptr, strlen (cptr));
inodes_box_start = 100 + line_len;
line_len += (FWIDTH * strlen (cptr)) + space;
sprintf (s80, "%s", "Proc");
cptr = s80;
XSetForeground (temp_display, temp_gc, foreground);
XDrawString (temp_display, temp_window, temp_gc,
100 + line_len, FHEIGHT * 3,
cptr, strlen (cptr));
proc_box_start = 100 + line_len;
line_len += (FWIDTH * strlen (cptr)) + space;
sprintf (s80, "%s", "Region");
cptr = s80;
XSetForeground (temp_display, temp_gc, foreground);
XDrawString (temp_display, temp_window, temp_gc,
100 + line_len, FHEIGHT * 3,
cptr, strlen (cptr));
region_box_start = 100 + line_len;
line_len += (FWIDTH * strlen (cptr)) + space;
sprintf (s80, "%s", "Cblocks");
cptr = s80;
XSetForeground (temp_display, temp_gc, foreground);
XDrawString (temp_display, temp_window, temp_gc,
100 + line_len, FHEIGHT * 3,
cptr, strlen (cptr));
cblocks_box_start = 100 + line_len;
/*
* Draw OK, Warning, and Alarm Strings
*/
sprintf (s80, "%s", "O.K.");
cptr = s80;
XSetForeground (temp_display, temp_gc, foreground);
XDrawString (temp_display, temp_window, temp_gc,
10, FHEIGHT * 6,
cptr, strlen (cptr));
sprintf (s80, "%s", "Warning");
cptr = s80;
XSetForeground (temp_display, temp_gc, foreground);
XDrawString (temp_display, temp_window, temp_gc,
10, FHEIGHT * 9,
cptr, strlen (cptr));
sprintf (s80, "%s", "Alarm");
cptr = s80;
XSetForeground (temp_display, temp_gc, foreground);
XDrawString (temp_display, temp_window, temp_gc,
10, FHEIGHT * 12,
cptr, strlen (cptr));
/*
* Draw colored O.k. boxes .....
*/
XSetForeground (temp_display, temp_gc, foreground);
XSetLineAttributes (temp_display, temp_gc, BOXTHICKNESS,
LineSolid, CapButt, JoinMiter);
XDrawRectangle (temp_display, temp_window, temp_gc,
x = file_box_start,
y = (FHEIGHT * 6) - FHEIGHT,
w = FWIDTH * 2,
h = FHEIGHT);
XSetForeground (temp_display, temp_gc, colorNfile.pixel);
XFillRectangle (temp_display, temp_window, temp_gc, x, y, w, h);
XSetForeground (temp_display, temp_gc, foreground);
XSetLineAttributes (temp_display, temp_gc, BOXTHICKNESS,
LineSolid, CapButt, JoinMiter);
XDrawRectangle (temp_display, temp_window, temp_gc,
x = inodes_box_start,
y = (FHEIGHT * 6) - FHEIGHT,
w = FWIDTH * 2,
h = FHEIGHT);
XSetForeground (temp_display, temp_gc, colorNinode.pixel);
XFillRectangle (temp_display, temp_window, temp_gc, x, y, w, h);
XSetForeground (temp_display, temp_gc, foreground);
XSetLineAttributes (temp_display, temp_gc, BOXTHICKNESS,
LineSolid, CapButt, JoinMiter);
XDrawRectangle (temp_display, temp_window, temp_gc,
x = proc_box_start,
y = (FHEIGHT * 6) - FHEIGHT,
w = FWIDTH * 2,
h = FHEIGHT);
XSetForeground (temp_display, temp_gc, colorNproc.pixel);
XFillRectangle (temp_display, temp_window, temp_gc, x, y, w, h);
XSetForeground (temp_display, temp_gc, foreground);
XSetLineAttributes (temp_display, temp_gc, BOXTHICKNESS,
LineSolid, CapButt, JoinMiter);
XDrawRectangle (temp_display, temp_window, temp_gc,
x = region_box_start,
y = (FHEIGHT * 6) - FHEIGHT,
w = FWIDTH * 2,
h = FHEIGHT);
XSetForeground (temp_display, temp_gc, colorNregion.pixel);
XFillRectangle (temp_display, temp_window, temp_gc, x, y, w, h);
XSetForeground (temp_display, temp_gc, foreground);
XSetLineAttributes (temp_display, temp_gc, BOXTHICKNESS,
LineSolid, CapButt, JoinMiter);
XDrawRectangle (temp_display, temp_window, temp_gc,
x = cblocks_box_start,
y = (FHEIGHT * 6) - FHEIGHT,
w = FWIDTH * 2,
h = FHEIGHT);
XSetForeground (temp_display, temp_gc, colorNcblocks.pixel);
XFillRectangle (temp_display, temp_window, temp_gc, x, y, w, h);
/*
* Draw colored Warning boxes .....
*/
XSetForeground (temp_display, temp_gc, foreground);
XSetLineAttributes (temp_display, temp_gc, BOXTHICKNESS,
LineSolid, CapButt, JoinMiter);
XDrawRectangle (temp_display, temp_window, temp_gc,
x = file_box_start,
y = (FHEIGHT * 9) - FHEIGHT,
w = FWIDTH * 2,
h = FHEIGHT);
XSetForeground (temp_display, temp_gc, colorNfileWarning.pixel);
XFillRectangle (temp_display, temp_window, temp_gc, x, y, w, h);
XSetForeground (temp_display, temp_gc, foreground);
XSetLineAttributes (temp_display, temp_gc, BOXTHICKNESS,
LineSolid, CapButt, JoinMiter);
XDrawRectangle (temp_display, temp_window, temp_gc,
x = inodes_box_start,
y = (FHEIGHT * 9) - FHEIGHT,
w = FWIDTH * 2,
h = FHEIGHT);
XSetForeground (temp_display, temp_gc, colorNinodeWarning.pixel);
XFillRectangle (temp_display, temp_window, temp_gc, x, y, w, h);
XSetForeground (temp_display, temp_gc, foreground);
XSetLineAttributes (temp_display, temp_gc, BOXTHICKNESS,
LineSolid, CapButt, JoinMiter);
XDrawRectangle (temp_display, temp_window, temp_gc,
x = proc_box_start,
y = (FHEIGHT * 9) - FHEIGHT,
w = FWIDTH * 2,
h = FHEIGHT);
XSetForeground (temp_display, temp_gc, colorNprocWarning.pixel);
XFillRectangle (temp_display, temp_window, temp_gc, x, y, w, h);
XSetForeground (temp_display, temp_gc, foreground);
XSetLineAttributes (temp_display, temp_gc, BOXTHICKNESS,
LineSolid, CapButt, JoinMiter);
XDrawRectangle (temp_display, temp_window, temp_gc,
x = region_box_start,
y = (FHEIGHT * 9) - FHEIGHT,
w = FWIDTH * 2,
h = FHEIGHT);
XSetForeground (temp_display, temp_gc, colorNregionWarning.pixel);
XFillRectangle (temp_display, temp_window, temp_gc, x, y, w, h);
XSetForeground (temp_display, temp_gc, foreground);
XSetLineAttributes (temp_display, temp_gc, BOXTHICKNESS,
LineSolid, CapButt, JoinMiter);
XDrawRectangle (temp_display, temp_window, temp_gc,
x = cblocks_box_start,
y = (FHEIGHT * 9) - FHEIGHT,
w = FWIDTH * 2,
h = FHEIGHT);
XSetForeground (temp_display, temp_gc, colorNcblocksWarning.pixel);
XFillRectangle (temp_display, temp_window, temp_gc, x, y, w, h);
/*
* Draw colored Alarm boxes .....
*/
XSetForeground (temp_display, temp_gc, foreground);
XSetLineAttributes (temp_display, temp_gc, BOXTHICKNESS,
LineSolid, CapButt, JoinMiter);
XDrawRectangle (temp_display, temp_window, temp_gc,
x = file_box_start,
y = (FHEIGHT * 12) - FHEIGHT,
w = FWIDTH * 2,
h = FHEIGHT);
XSetForeground (temp_display, temp_gc, colorNfileAlarm.pixel);
XFillRectangle (temp_display, temp_window, temp_gc, x, y, w, h);
XSetForeground (temp_display, temp_gc, foreground);
XSetLineAttributes (temp_display, temp_gc, BOXTHICKNESS,
LineSolid, CapButt, JoinMiter);
XDrawRectangle (temp_display, temp_window, temp_gc,
x = inodes_box_start,
y = (FHEIGHT * 12) - FHEIGHT,
w = FWIDTH * 2,
h = FHEIGHT);
XSetForeground (temp_display, temp_gc, colorNinodeAlarm.pixel);
XFillRectangle (temp_display, temp_window, temp_gc, x, y, w, h);
XSetForeground (temp_display, temp_gc, foreground);
XSetLineAttributes (temp_display, temp_gc, BOXTHICKNESS,
LineSolid, CapButt, JoinMiter);
XDrawRectangle (temp_display, temp_window, temp_gc,
x = proc_box_start,
y = (FHEIGHT * 12) - FHEIGHT,
w = FWIDTH * 2,
h = FHEIGHT);
XSetForeground (temp_display, temp_gc, colorNprocAlarm.pixel);
XFillRectangle (temp_display, temp_window, temp_gc, x, y, w, h);
XSetForeground (temp_display, temp_gc, foreground);
XSetLineAttributes (temp_display, temp_gc, BOXTHICKNESS,
LineSolid, CapButt, JoinMiter);
XDrawRectangle (temp_display, temp_window, temp_gc,
x = region_box_start,
y = (FHEIGHT * 12) - FHEIGHT,
w = FWIDTH * 2,
h = FHEIGHT);
XSetForeground (temp_display, temp_gc, colorNregionAlarm.pixel);
XFillRectangle (temp_display, temp_window, temp_gc, x, y, w, h);
XSetForeground (temp_display, temp_gc, foreground);
XSetLineAttributes (temp_display, temp_gc, BOXTHICKNESS,
LineSolid, CapButt, JoinMiter);
XDrawRectangle (temp_display, temp_window, temp_gc,
x = cblocks_box_start,
y = (FHEIGHT * 12) - FHEIGHT,
w = FWIDTH * 2,
h = FHEIGHT);
XSetForeground (temp_display, temp_gc, colorNcblocksAlarm.pixel);
XFillRectangle (temp_display, temp_window, temp_gc, x, y, w, h);
break;
case BUTTON_mem:
/*
* Draw title strings.....
*/
sprintf (s80, "%s", "Memory Used");
cptr = s80;
line_len = 0;
XSetForeground (temp_display, temp_gc, foreground);
XDrawString (temp_display, temp_window, temp_gc, 100, FHEIGHT * 3,
cptr, strlen (cptr));
file_box_start = 100;
line_len += (FWIDTH * strlen (cptr)) + space;
sprintf (s80, "%s", "Swap Used");
cptr = s80;
XSetForeground (temp_display, temp_gc, foreground);
XDrawString (temp_display, temp_window, temp_gc,
100 + line_len, FHEIGHT * 3,
cptr, strlen (cptr));
inodes_box_start = 100 + line_len;
line_len += (FWIDTH * strlen (cptr)) + space;
sprintf (s80, "%s", "Avail. Swap Used");
cptr = s80;
XSetForeground (temp_display, temp_gc, foreground);
XDrawString (temp_display, temp_window, temp_gc,
100 + line_len, FHEIGHT * 3,
cptr, strlen (cptr));
proc_box_start = 100 + line_len;
line_len += (FWIDTH * strlen (cptr)) + space;
/*
* Draw OK, Warning, and Alarm Strings
*/
sprintf (s80, "%s", "O.K.");
cptr = s80;
XSetForeground (temp_display, temp_gc, foreground);
XDrawString (temp_display, temp_window, temp_gc,
10, FHEIGHT * 6,
cptr, strlen (cptr));
sprintf (s80, "%s", "Warning");
cptr = s80;
XSetForeground (temp_display, temp_gc, foreground);
XDrawString (temp_display, temp_window, temp_gc,
10, FHEIGHT * 9,
cptr, strlen (cptr));
sprintf (s80, "%s", "Alarm");
cptr = s80;
XSetForeground (temp_display, temp_gc, foreground);
XDrawString (temp_display, temp_window, temp_gc,
10, FHEIGHT * 12,
cptr, strlen (cptr));
/*
* Draw colored O.k. boxes .....
*/
XSetForeground (temp_display, temp_gc, foreground);
XSetLineAttributes (temp_display, temp_gc, BOXTHICKNESS,
LineSolid, CapButt, JoinMiter);
XDrawRectangle (temp_display, temp_window, temp_gc,
x = file_box_start,
y = (FHEIGHT * 6) - FHEIGHT,
w = FWIDTH * 2,
h = FHEIGHT);
XSetForeground (temp_display, temp_gc, colorMemUsed.pixel);
XFillRectangle (temp_display, temp_window, temp_gc, x, y, w, h);
XSetForeground (temp_display, temp_gc, foreground);
XSetLineAttributes (temp_display, temp_gc, BOXTHICKNESS,
LineSolid, CapButt, JoinMiter);
XDrawRectangle (temp_display, temp_window, temp_gc,
x = inodes_box_start,
y = (FHEIGHT * 6) - FHEIGHT,
w = FWIDTH * 2,
h = FHEIGHT);
XSetForeground (temp_display, temp_gc, colorSwapUsed.pixel);
XFillRectangle (temp_display, temp_window, temp_gc, x, y, w, h);
XSetForeground (temp_display, temp_gc, foreground);
XSetLineAttributes (temp_display, temp_gc, BOXTHICKNESS,
LineSolid, CapButt, JoinMiter);
XDrawRectangle (temp_display, temp_window, temp_gc,
x = proc_box_start,
y = (FHEIGHT * 6) - FHEIGHT,
w = FWIDTH * 2,
h = FHEIGHT);
XSetForeground (temp_display, temp_gc, colorAvailSwapUsed.pixel);
XFillRectangle (temp_display, temp_window, temp_gc, x, y, w, h);
/*
* Draw colored Warning boxes .....
*/
XSetForeground (temp_display, temp_gc, foreground);
XSetLineAttributes (temp_display, temp_gc, BOXTHICKNESS,
LineSolid, CapButt, JoinMiter);
XDrawRectangle (temp_display, temp_window, temp_gc,
x = file_box_start,
y = (FHEIGHT * 9) - FHEIGHT,
w = FWIDTH * 2,
h = FHEIGHT);
XSetForeground (temp_display, temp_gc, colorMemUsedWarning.pixel);
XFillRectangle (temp_display, temp_window, temp_gc, x, y, w, h);
XSetForeground (temp_display, temp_gc, foreground);
XSetLineAttributes (temp_display, temp_gc, BOXTHICKNESS,
LineSolid, CapButt, JoinMiter);
XDrawRectangle (temp_display, temp_window, temp_gc,
x = inodes_box_start,
y = (FHEIGHT * 9) - FHEIGHT,
w = FWIDTH * 2,
h = FHEIGHT);
XSetForeground (temp_display, temp_gc, colorSwapUsedWarning.pixel);
XFillRectangle (temp_display, temp_window, temp_gc, x, y, w, h);
XSetForeground (temp_display, temp_gc, foreground);
XSetLineAttributes (temp_display, temp_gc, BOXTHICKNESS,
LineSolid, CapButt, JoinMiter);
XDrawRectangle (temp_display, temp_window, temp_gc,
x = proc_box_start,
y = (FHEIGHT * 9) - FHEIGHT,
w = FWIDTH * 2,
h = FHEIGHT);
XSetForeground (temp_display, temp_gc, colorAvailSwapUsedWarning.pixel);
XFillRectangle (temp_display, temp_window, temp_gc, x, y, w, h);
/*
* Draw colored Alarm boxes .....
*/
XSetForeground (temp_display, temp_gc, foreground);
XSetLineAttributes (temp_display, temp_gc, BOXTHICKNESS,
LineSolid, CapButt, JoinMiter);
XDrawRectangle (temp_display, temp_window, temp_gc,
x = file_box_start,
y = (FHEIGHT * 12) - FHEIGHT,
w = FWIDTH * 2,
h = FHEIGHT);
XSetForeground (temp_display, temp_gc, colorMemUsedAlarm.pixel);
XFillRectangle (temp_display, temp_window, temp_gc, x, y, w, h);
XSetForeground (temp_display, temp_gc, foreground);
XSetLineAttributes (temp_display, temp_gc, BOXTHICKNESS,
LineSolid, CapButt, JoinMiter);
XDrawRectangle (temp_display, temp_window, temp_gc,
x = inodes_box_start,
y = (FHEIGHT * 12) - FHEIGHT,
w = FWIDTH * 2,
h = FHEIGHT);
XSetForeground (temp_display, temp_gc, colorSwapUsedAlarm.pixel);
XFillRectangle (temp_display, temp_window, temp_gc, x, y, w, h);
XSetForeground (temp_display, temp_gc, foreground);
XSetLineAttributes (temp_display, temp_gc, BOXTHICKNESS,
LineSolid, CapButt, JoinMiter);
XDrawRectangle (temp_display, temp_window, temp_gc,
x = proc_box_start,
y = (FHEIGHT * 12) - FHEIGHT,
w = FWIDTH * 2,
h = FHEIGHT);
XSetForeground (temp_display, temp_gc, colorAvailSwapUsedAlarm.pixel);
XFillRectangle (temp_display, temp_window, temp_gc, x, y, w, h);
break;
case BUTTON_ps_cpu:
sprintf (s80, "%s", "Process is IDLE");
cptr = s80;
set_color_dialog_string (FHEIGHT * 3, cptr, colorPScpuIdle.pixel);
sprintf (s80, "%s", "Process has RUN");
cptr = s80;
set_color_dialog_string (FHEIGHT * 6, cptr, colorPScpuActive.pixel);
sprintf (s80, "%s", "Process currently RUNNING");
cptr = s80;
set_color_dialog_string (FHEIGHT * 9, cptr, colorPScpuRunning.pixel);
sprintf (s80, "%s", "Process is NEW");
cptr = s80;
set_color_dialog_string (FHEIGHT * 12, cptr, colorPScpuNew.pixel);
break;
case BUTTON_ps_io:
sprintf (s80, "%s", "Process is IDLE");
cptr = s80;
set_color_dialog_string (FHEIGHT * 3, cptr, colorPSioIdle.pixel);
sprintf (s80, "%s", "Process has I/0");
cptr = s80;
set_color_dialog_string (FHEIGHT * 6, cptr, colorPSioActive.pixel);
sprintf (s80, "%s", "Process is NEW");
cptr = s80;
set_color_dialog_string (FHEIGHT * 9, cptr, colorPSioNew.pixel);
break;
case BUTTON_ps_mem:
sprintf (s80, "%s", "Process is not GROWING/SHRINKING");
cptr = s80;
set_color_dialog_string (FHEIGHT * 3, cptr, colorPSmem.pixel);
sprintf (s80, "%s", "Process is GROWING");
cptr = s80;
set_color_dialog_string (FHEIGHT * 6, cptr, colorPSmemGrowing.pixel);
sprintf (s80, "%s", "Process is SHRINKING");
cptr = s80;
set_color_dialog_string (FHEIGHT * 9, cptr, colorPSmemShrinking.pixel);
sprintf (s80, "%s", "Process is NEW");
cptr = s80;
set_color_dialog_string (FHEIGHT * 12, cptr, colorPSmemNew.pixel);
break;
case BUTTON_streams:
sprintf (s80, "%s", "Static numeric");
cptr = s80;
set_color_dialog_string (FHEIGHT * 3, cptr, colorStaticNumeric.pixel);
sprintf (s80, "%s", "Numeric");
cptr = s80;
set_color_dialog_string (FHEIGHT * 6, cptr, colorNumeric.pixel);
sprintf (s80, "%s", "Numeric Warning");
cptr = s80;
set_color_dialog_string (FHEIGHT * 9, cptr, colorNumericWarning.pixel);
sprintf (s80, "%s", "Numeric Alarm");
cptr = s80;
set_color_dialog_string (FHEIGHT * 12, cptr, colorNumericAlarm.pixel);
break;
case BUTTON_nfsstat:
sprintf (s80, "%s", "Numeric");
cptr = s80;
set_color_dialog_string (FHEIGHT * 3, cptr, colorNumeric.pixel);
sprintf (s80, "%s", "Numeric Alarm");
cptr = s80;
set_color_dialog_string (FHEIGHT * 6, cptr, colorNumericAlarm.pixel);
break;
case BUTTON_sysinfo:
sprintf (s80, "%s", "Numeric");
cptr = s80;
set_color_dialog_string (FHEIGHT * 3, cptr, colorNumeric.pixel);
break;
case BUTTON_tune_var:
sprintf (s80, "%s", "Static numeric");
cptr = s80;
set_color_dialog_string (FHEIGHT * 3, cptr, colorLabel.pixel);
break;
case BUTTON_dev_stats:
sprintf (s80, "%s", "Numeric");
cptr = s80;
set_color_dialog_string (FHEIGHT * 3, cptr, colorNumeric.pixel);
break;
case BUTTON_disk_space:
sprintf (s80, "%s", "Gaining disk space");
cptr = s80;
set_color_dialog_string (FHEIGHT * 3, cptr, colorDiskspaceGaining.pixel);
sprintf (s80, "%s", "Losing disk space");
cptr = s80;
set_color_dialog_string (FHEIGHT * 6, cptr, colorDiskspaceLosing.pixel);
sprintf (s80, "%s", "Stable disk space");
cptr = s80;
set_color_dialog_string (FHEIGHT * 9, cptr, colorDiskspaceStable.pixel);
sprintf (s80, "%s", "Static numeric/text");
cptr = s80;
set_color_dialog_string (FHEIGHT * 12, cptr, colorStaticNumeric.pixel);
break;
}
}
void
create_color_help (local_window)
Window local_window;
{
int i;
int j;
Arg args[32];
int argcount;
int button_num;
int popup_width, popup_height;
int buffer = 20;
Window root_window, child_return;
int root_x_return, root_y_return;
int win_x_return, win_y_return;
unsigned int mask_return;
Boolean results;
int found_button = 0;
XFontStruct *Current_Font;
XmFontList Font_List;
static int help_popup_created = 0;
struct expose_callback_struct *expose_data;
struct NetworkXswStruct *server_pointer = NULL;
results = XQueryPointer (display,
window,
&root_window, &child_return,
&root_x_return, &root_y_return,
&win_x_return, &win_y_return, &mask_return);
/*
* Determine the "window" which is associated with the pointer position
*/
server_pointer = head_server;
for (i = 0; i < server_count; i++)
{
for (j = 0; j < server_pointer -> current_items; j++)
{
if (server_pointer -> SEPERATE_WINDOWS_LIST[server_pointer -> DISPLAY_LIST[j].button_num].window == local_window)
{
button_num = server_pointer -> DISPLAY_LIST[j].button_num;
found_button = 1;
break;
}
}
if (found_button)
break;
server_pointer = server_pointer -> forward_link;
}
if (!found_button)
{
return;
}
doing_help = 1;
/*
* Position popup near the pointer
*/
argcount = 0;
switch (button_num)
{
case BUTTON_cpu:
popup_width = FWIDTH * 42;
popup_height = FHEIGHT * 20;
break;
case BUTTON_wait:
popup_width = FWIDTH * 42;
popup_height = FHEIGHT * 20;
break;
case BUTTON_cache:
popup_width = FWIDTH * 46;
popup_height = FHEIGHT * 28;
break;
case BUTTON_other:
popup_width = FWIDTH * 65;
popup_height = FHEIGHT * 16;
argcount++;
break;
case BUTTON_mem:
popup_width = FWIDTH * 65;
popup_height = FHEIGHT * 16;
break;
case BUTTON_ps_cpu:
popup_width = FWIDTH * 42;
popup_height = FHEIGHT * 16;
break;
case BUTTON_ps_io:
popup_width = FWIDTH * 42;
popup_height = FHEIGHT * 12;
break;
case BUTTON_ps_mem:
popup_width = FWIDTH * 48;
popup_height = FHEIGHT * 16;
break;
case BUTTON_streams:
popup_width = FWIDTH * 48;
popup_height = FHEIGHT * 16;
break;
case BUTTON_nfsstat:
popup_width = FWIDTH * 48;
popup_height = FHEIGHT * 12;
break;
case BUTTON_sysinfo:
popup_width = FWIDTH * 48;
popup_height = FHEIGHT * 6;
break;
case BUTTON_tune_var:
popup_width = FWIDTH * 48;
popup_height = FHEIGHT * 8;
break;
case BUTTON_dev_stats:
popup_width = FWIDTH * 46;
popup_height = FHEIGHT * 6;
break;
case BUTTON_disk_space:
popup_width = FWIDTH * 48;
popup_height = FHEIGHT * 16;
break;
}
if (root_x_return + popup_width + buffer >
WidthOfScreen (XtScreen (toplevel)))
root_x_return = WidthOfScreen (XtScreen (toplevel)) - popup_width - buffer;
if ((root_y_return + popup_height + buffer) >
HeightOfScreen (XtScreen (toplevel)))
root_y_return = HeightOfScreen (XtScreen (toplevel)) -
popup_height - buffer;
if (!server_pointer ->
SEPERATE_WINDOWS_LIST[button_num].help_color_already_created)
{
argcount = 0;
XtSetArg (args[argcount], XmNdeleteResponse, XmUNMAP);
argcount++;
XtSetArg (args[argcount], XmNallowShellResize, True);
argcount++;
XtSetArg (args[argcount], XmNx, root_x_return);
argcount++;
XtSetArg (args[argcount], XmNy, root_y_return);
argcount++;
XtSetArg (args[argcount], XmNsaveUnder, True);
argcount++;
server_pointer -> SEPERATE_WINDOWS_LIST[button_num].colorHelp.toplevel =
XtCreatePopupShell
("Color Map",
xmDialogShellWidgetClass,
server_pointer -> SEPERATE_WINDOWS_LIST[button_num].shell_widget,
args, argcount);
server_pointer -> SEPERATE_WINDOWS_LIST[button_num].colorHelp.display =
XtDisplay (server_pointer ->
SEPERATE_WINDOWS_LIST[button_num].colorHelp.toplevel);
server_pointer -> SEPERATE_WINDOWS_LIST[button_num].colorHelp.screen =
DefaultScreen (server_pointer ->
SEPERATE_WINDOWS_LIST[button_num].colorHelp.display);
server_pointer -> SEPERATE_WINDOWS_LIST[button_num].colorHelp.gc =
DefaultGC (server_pointer ->
SEPERATE_WINDOWS_LIST[button_num].colorHelp.display,
server_pointer ->
SEPERATE_WINDOWS_LIST[button_num].colorHelp.screen);
argcount = 0;
XtSetArg (args[argcount], XmNwidth, popup_width);
argcount++;
XtSetArg (args[argcount], XmNheight, popup_height);
argcount++;
XtSetArg (args[argcount], XmNforeground, foreground);
argcount++;
XtSetArg (args[argcount], XmNbackground, background);
argcount++;
server_pointer ->
SEPERATE_WINDOWS_LIST[button_num].colorHelp.drawing_area =
XmCreateDrawingArea (server_pointer ->
SEPERATE_WINDOWS_LIST[button_num].colorHelp.toplevel,
"xsw-draw", args, argcount);
XtManageChild (server_pointer ->
SEPERATE_WINDOWS_LIST[button_num].colorHelp.drawing_area);
expose_data = (struct expose_callback_struct *)
calloc (1, sizeof (struct expose_callback_struct));
expose_data -> server_pointer = server_pointer;
expose_data -> button_number = button_num;
XtAddCallback (server_pointer ->
SEPERATE_WINDOWS_LIST[button_num].colorHelp.drawing_area,
XmNexposeCallback, popup_callback, expose_data);
argcount = 0;
XtSetArg (args[argcount], XmNx, root_x_return);
argcount++;
XtSetArg (args[argcount], XmNy, root_y_return);
argcount++;
XtSetValues (server_pointer ->
SEPERATE_WINDOWS_LIST[button_num].colorHelp.toplevel,
args, argcount);
argcount = 0;
XtSetArg (args[argcount], XmNwidth, popup_width);
argcount++;
XtSetArg (args[argcount], XmNheight, popup_height);
argcount++;
XtSetValues (server_pointer ->
SEPERATE_WINDOWS_LIST[button_num].colorHelp.drawing_area,
args, argcount);
server_pointer ->
SEPERATE_WINDOWS_LIST[button_num].help_color_already_created = 1;
/*
* The following global variable is needed for popdown. It is assumed that
* only ONE color help popup window is up at ONE time..
*/
}
else
{
argcount = 0;
XtSetArg (args[argcount], XmNx, root_x_return);
argcount++;
XtSetArg (args[argcount], XmNy, root_y_return);
argcount++;
XtSetValues (server_pointer ->
SEPERATE_WINDOWS_LIST[button_num].colorHelp.toplevel,
args, argcount);
}
current_colorHelp_button_num = button_num;
XSetFont (server_pointer ->
SEPERATE_WINDOWS_LIST[button_num].colorHelp.display,
server_pointer -> SEPERATE_WINDOWS_LIST[button_num].colorHelp.gc,
server_pointer -> My_font);
XtPopup (server_pointer ->
SEPERATE_WINDOWS_LIST[button_num].colorHelp.toplevel,
XtGrabNone);
}